/******************************************************************
*
* Copyright 2010 Darshan M Sonde
*
* This file is part of ddots.
*
* ddots is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ddots is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ddots.  If not, see <http://www.gnu.org/licenses/>.
*
*********************************************************************/

#ifndef ENGINEINTERFACE_H
#define ENGINEINTERFACE_H

#include <QString>
#include <QtCore>

class EngineInterface
{
public:
    virtual ~EngineInterface(){}

    virtual QString name()=0;//if name is same with another plugin it wont be loaded.

        /* this function will be called before the game starts.
           this represents the grid of r,c points.
            minimum rows=2,cols=2 */
        virtual void initGame(int rows,int cols)=0;

        /* this is called whenever a move is received from user or
           another program and should calculate and store the best
           results to be fetched from next function. return false if
           the edge is already filled. something went wrong! or illegal move*/
        virtual bool doMove(int startRow,int startCol,
                            int endRow, int endCol)=0;
        /* this function should populate the variables passed.
           this is the engine move . return true if everything went fine.
            if game is over or not engine's turn return false. */
        virtual bool getMove(int &startRow,int &startCol,
                             int &endRow, int &endCol)=0;

        /* this function is called if the user wants to undo.
           return false if undo is not possible. default is no undo possible.
           this is called to undo move for this engine and human play combined. */
        virtual bool undoMove() { return false; }
};

Q_DECLARE_INTERFACE(EngineInterface,"darc.game.ddots.engine/1.0")

#endif // ENGINEINTERFACE_H
